from config import parse
from tool import mns_time
from log import mns_log
import world
from host import host_manage

if __name__ == "__main__":
    config_file_path = "./config/default_config.yaml"
    # 初始化日志文件
    mns_log.Log.init_log(config_file_path)
    # 解析配置文件
    parse.Parse.parse_config(config_file_path)
    # # 配置仿真时间
    mns_time.Time.init()
    # 生成世界
    world = world.World()
    # 启动造船工厂
    factory = world.activate_ship_factory()
    # 开始建造船只
    ship_list = world.create_ship()
    # 生成节点管理工具
    manage = host_manage.HostManage()
    # 给所有船只安装节点
    manage.install_host_to_all_ship(ship_list)
    # 所有节点启动
    manage.setup_all_host()
    # 开始仿真
    world.daemon = True
    world.start()
    # 仿真结束，关闭线程
